feat: centralize dynamic env var construction in config.py, remove composite vars from .env#1105
Merged
Conversation
- Added PostgreSQL, Redis, and Elasticsearch configuration fields to `Config` class in `config.py`. - Updated `env.template` to reflect new environment variables for Redis and Elasticsearch. - Removed redundant URL construction from `entrypoint.sh`, as URLs are now built within the `Config` class. - Adjusted `start-celery-flower.sh` to simplify Celery command execution.
There was a problem hiding this comment.
Bug: Redis URL Issues and Database Default Change
The commit introduces two issues:
- Redis URL Malformation: The
CELERY_BROKER_URLandMEMORY_REDIS_URLare malformed whenredis_userorredis_passwordare empty strings (e.g.,redis://:@host:port/0). The URL construction does not properly handle empty credentials, unlike theES_HOSTconstruction. - Breaking Change in Default Database: The default
DATABASE_URLbehavior changed from SQLite to PostgreSQL. Previously, it defaulted tosqlite:///{BASE_DIR}/db.sqlite3. Now, if not explicitly set, it defaults toNoneand is then constructed as a PostgreSQL URL usingpostgres_*fields. This breaks backward compatibility for existing deployments relying on the SQLite default.
aperag/config.py#L71-L189
Lines 71 to 189 in 860985c
Was this report helpful? Give feedback by reacting with 👍 or 👎
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Configclass inconfig.py.env.templateto reflect new environment variables for Redis and Elasticsearch.entrypoint.sh, as URLs are now built within theConfigclass.start-celery-flower.shto simplify Celery command execution.